package com.google.coffeeshop.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "product_group")
public class ProductGroupDTO implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "id")
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	@Column(name = "name", nullable = false)
	private String name;
	@Column(name = "code", nullable = false, unique = true)
	private String code;
	@Column(name = "description")
	private String description;
//	@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.MERGE, mappedBy = "group")
//	private List<ProductDTO> productDTO;
	
//	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.MERGE)
//	@JoinColumn(name = "parent_group_id", nullable = false)
//	private ProductGroupDTO parentProductGroupDTO;

	@Override
	public String toString() {
		return String.format("id=%d, code='%s'", id, code);
	}

	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
//	public List<ProductDTO> getProductDTO() {
//		return productDTO;
//	}
//	public void setProductDTO(List<ProductDTO> productDTO) {
//		this.productDTO = productDTO;
//	}
//	public ProductGroupDTO getParentProductGroupDTO() {
//		return parentProductGroupDTO;
//	}
//	public void setParentProductGroupDTO(ProductGroupDTO parentProductGroupDTO) {
//		this.parentProductGroupDTO = parentProductGroupDTO;
//	}

}
